//
//  TriviaController.m
//  MathMasterMain
//
//  Created by Jimmy Hahm on 10-03-27.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "TriviaController.h"
#import "Trivia.h"

@implementation TriviaController
@synthesize trivia;
@synthesize tutorialView;
@synthesize tutorialIMG;
@synthesize tutorialLabel;

-(IBAction)startTrivia:(id)sender {
	Trivia *X = [[Trivia alloc] initWithNibName:@"Trivia" bundle:nil];
	self.trivia = X;
	[X release];
	lastScoreLabel.text = [NSString stringWithFormat:@"Last Score: %d", trivia.returnScore];
	//lastScoreLabel.text = [NSString stringWithFormat:@"Last Score: %d", [trivia returnScore]];
	[self presentModalViewController:trivia animated:YES];	
}

-(IBAction)openTutorial:(id)sender{
	[self.view addSubview:tutorialView];
	[self.view bringSubviewToFront:tutorialView];
	tutorialView.hidden = FALSE;
}
-(IBAction)closeTutorial:(id)sender{
	tutorialView.hidden = TRUE;
	[tutorialView removeFromSuperview];
}

-(IBAction)tutorial1:(id)sender{
	UIImage* img = [UIImage imageNamed:@"trivia-tutorial-1.png"];
	[tutorialIMG setImage:img];
	tutorialLabel.text = @"Click on the correct answer out of the four options given at the bottom of the screen.\n Click \"Back\" anytime during the game to exit the current game.";
}
-(IBAction)tutorial2:(id)sender{
	UIImage* img = [UIImage imageNamed:@"trivia-tutorial-2.png"];
	[tutorialIMG setImage:img];
	tutorialLabel.text = @"When you press an answer, you will be notified with either a check mark or an X mark. \nPress \"Next Question\" to continue the game.";
}


/*
 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
 - (id)initWithNibName:(NS/String *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
 if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
 // Custom initialization
 }
 return self;
 }
 */

/*
 // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
 - (void)viewDidLoad {
 [super viewDidLoad];
 }
 */

/*
 // Override to allow orientations other than the default portrait orientation.
 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
 // Return YES for supported orientations
 return (interfaceOrientation == UIInterfaceOrientationPortrait);
 }
 */

- (void)didReceiveMemoryWarning {
	// Releases the view if it doesn't have a superview.
	
	[super didReceiveMemoryWarning];
	
	
	// Release any cached data, images, etc that aren't in use.
}




- (void)viewDidUnload {
	// Release any retained subviews of the main view.
	// e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}


@end
